package chai.ningning.address;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

/**
 * 1、抽象类 java.net.SocketAddress 的实例表示不带任何协议附件的 Socket Address
 * 2、具体类 java.net.InetSocketAddress 继承了 java.net.SocketAddress 类
 * 3、java.net.InetSocketAddress 实例表示 包含了 IP地址 和 端口号 的地址
 */
public class SocketAddressTest1 {

    public static void main(String[] args) throws UnknownHostException {

       /* InetAddress address = InetAddress.getByName("1.0.0.58");
        InetAddress inetAddress = InetAddress.getLocalHost();
        System.out.println(inetAddress);*/

        int port = 5555;
        InetSocketAddress isa = new InetSocketAddress(port);
        System.out.println(isa);
    }
}
